from django.conf.urls.defaults import *
from django.contrib import admin

admin.autodiscover()

# from django_site import viewSiteIndex

SITE_INDEX = '''<html>
  <head>
    <title>Site Index</title>
  </head>
  <body>
    <h2>Site Index</h2>
    <ul>
    {% for url in URLS %}
      <li><a href="{{ url.href }}">{{ url.title }}</a></li>
    {% endfor %}
    </ul>
  </body>
</html>'''

def viewSiteIndex(request):
    from django.http import HttpResponse
    from django.template import Template, Context

    return HttpResponse(Template(SITE_INDEX).render(Context(dict(URLS = getSiteUrls()))))

def getSiteUrls():
    return [dict(href = 'facebook/',
                 title = 'Facebook Auth Facade')]

urlpatterns = patterns('',
    (r'^$', viewSiteIndex),

    (r'^facebook/', include('fbauthfacade.urls')),

    # Uncomment the admin/doc line below and add 'django.contrib.admindocs' 
    # to INSTALLED_APPS to enable admin documentation:
    (r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    (r'^admin/(.*)', admin.site.root),
)
